//
//  UIImageViewSwift.swift
//  Study-code
//
//  Created by quanhao huang on 2021/11/17.
//

import Foundation
import UIKit

/**
 我们都知道view是视图，那image view是什么呢？如其名，它是一个带图片的view，主要用于放置图片显示
 */
class CustomImageView: NSObject {
    func createUI() {
        //新建一个image view
        //一共两种创建方式，可以体验一下两种创建方式的区别
        //(1)
        let imgView1 = UIImageView.init(frame: CGRect(x: 0, y: 0, width: 100, height: 100))
        //设置图片
        imgView1.image = UIImage.init(named: "图片")
        //(2)
        let imgView2 = UIImageView.init(image: UIImage.init(named: "图片"))
        imgView2.frame = CGRect(x: 0, y: 0, width: 100, height: 100)
        //当然我还能这样
        let imgView3 = UIImageView.init()
        imgView3.image = UIImage.init(named: "图片")
        imgView3.frame = CGRect(x: 0, y: 0, width: 100, height: 100)
    }
}
